package com.kstech.ks_gaz01.test

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayout
import com.kstech.ks_gaz01.databinding.ActivityTabBinding

class TabActivity : AppCompatActivity() {
    val arr1 = arrayOf("111", "111", "111")
    val arr2 = arrayOf("22", "22", "22")
    private lateinit var binding: ActivityTabBinding
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding = ActivityTabBinding.inflate(layoutInflater)
        setContentView(binding.root)
        for (i in arr1.indices) {
            binding.tabLayout1.apply {
                addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
                    override fun onTabSelected(tab: TabLayout.Tab?) {

                    }

                    override fun onTabUnselected(tab: TabLayout.Tab?) {

                    }

                    override fun onTabReselected(tab: TabLayout.Tab?) {

                    }

                })
            }.addTab(binding.tabLayout1.newTab().apply {
                text = arr1[i]
            })
            binding.tabLayout2.addTab(binding.tabLayout2.newTab().setText(arr2[i]))


            binding.tabLayout1.selectedTabPosition
        }
    }
}